<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org" >
<head>
    <th:block th:include="include :: header('提交请假审核')" />
</head>
<body class="white-bg">
    <div class="wrapper wrapper-content animated fadeInRight ibox-content">
        <form class="form-horizontal m" id="form-leave-verify" th:object="${recordLeave}">
            <input name="leaveId" th:field="*{leaveId}" type="hidden">
            <input type="hidden" id="verifyType" name="verifyType" th:value="${verifyType}">
            <div class="form-group">
                <label class="col-sm-3 control-label">人员类型：</label>
                <div class="form-control-static" th:if="*{userType == '01'}">
                    普通职工
                </div>
                <div class="form-control-static" th:if="*{userType == '02'}">
                    中层及以上
                </div>
            </div>
            <div class="form-group" th:if="*{userType == '02'}">
                <label class="col-sm-3 control-label">代理人：</label>
                <div class="form-control-static" th:text="*{agentUser}">
                </div>
            </div>
            <div class="form-group">
                <label class="col-sm-3 control-label">休假类型：</label>
                <div class="form-control-static" th:text="*{@dict.getLabel('record_leave_type', leaveType)}">
                </div>
            </div>
            <div class="form-group">
                <label class="col-sm-3 control-label">请假事由：</label>
                <div class="form-control-static" th:text="*{leaveContent}">
                </div>
            </div>
            <div class="form-group">
                <label class="col-sm-3 control-label">开始时间：</label>
                <div class="form-control-static" th:text="*{#dates.format(startTime, 'yyyy-MM-dd')}">
                </div>
            </div>
            <div class="form-group">
                <label class="col-sm-3 control-label">结束时间：</label>
                <div class="form-control-static" th:text="*{#dates.format(endTime, 'yyyy-MM-dd')}">
                </div>
            </div>
            <div class="form-group">
                <label class="col-sm-3 control-label">天数：</label>
                <div class="form-control-static" th:text="*{days}">
                </div>
            </div>
            <div class="form-group">
                <label class="col-sm-3 control-label">备注：</label>
                <div class="form-control-static" th:text="*{remark}">
                </div>
            </div>
            <div class="form-group">
                <label class="col-sm-3 control-label">科室意见：</label>
                <div class="col-sm-2">
                    <div class="radio-box">
                        <input type="radio" name="chiefFlag" value="1" th:field="*{chiefFlag}">
                        <label>同意</label>
                    </div>
                    <div class="radio-box">
                        <input type="radio" name="chiefFlag" value="2" th:field="*{chiefFlag}">
                        <label>不同意</label>
                    </div>
                </div>
                <div class="col-sm-2">
                    <input id="chiefOpinion" name="chiefOpinion" class="form-control" th:field="*{chiefOpinion}" type="text">
                </div>
                <div class="col-sm-2" th:if="*{chiefFlag != '' && chiefFlag != null}">
                    <div class="form-control-static" th:text="*{chiefName}">
                    </div>
                    <div class="form-control-static" th:text="*{#dates.format(chiefTime, 'yyyy-MM-dd HH:mm:ss')}">
                    </div>
                </div>
            </div>
            <div class="form-group">
                <label class="col-sm-3 control-label">主管科室意见：</label>
                <div class="col-sm-2">
                    <div class="radio-box">
                        <input type="radio" name="manageFlag" value="1" th:field="*{manageFlag}">
                        <label>同意</label>
                    </div>
                    <div class="radio-box">
                        <input type="radio" name="manageFlag" value="2" th:field="*{manageFlag}">
                        <label>不同意</label>
                    </div>
                </div>
                <div class="col-sm-2">
                    <input id="manageOpinion" name="manageOpinion" class="form-control" th:field="*{manageOpinion}" type="text">
                </div>
                <div class="col-sm-2" th:if="*{manageFlag != '' && manageFlag != null}">
                    <div class="form-control-static" th:text="*{manageName}">
                    </div>
                    <div class="form-control-static" th:text="*{#dates.format(manageTime, 'yyyy-MM-dd HH:mm:ss')}">
                    </div>
                </div>
            </div>
            <div class="form-group">
                <label class="col-sm-3 control-label">人事科意见：</label>
                <div class="col-sm-2">
                    <div class="radio-box">
                        <input type="radio" name="humanFlag" value="1" th:field="*{humanFlag}">
                        <label>同意</label>
                    </div>
                    <div class="radio-box">
                        <input type="radio" name="humanFlag" value="2" th:field="*{humanFlag}">
                        <label>不同意</label>
                    </div>
                </div>
                <div class="col-sm-2">
                    <input id="humanOpinion" name="humanOpinion" class="form-control" th:field="*{humanOpinion}" type="text">
                </div>
                <div class="col-sm-2" th:if="*{humanFlag != '' && humanFlag != null}">
                    <div class="form-control-static" th:text="*{humanName}">
                    </div>
                    <div class="form-control-static" th:text="*{#dates.format(humanTime, 'yyyy-MM-dd HH:mm:ss')}">
                    </div>
                </div>
            </div>
            <div class="form-group">
                <label class="col-sm-3 control-label">主管科室分管领导意见：</label>
                <div class="col-sm-2">
                    <div class="radio-box">
                        <input type="radio" name="leaderFlag" value="1" th:field="*{leaderFlag}">
                        <label>同意</label>
                    </div>
                    <div class="radio-box">
                        <input type="radio" name="leaderFlag" value="2" th:field="*{leaderFlag}">
                        <label>不同意</label>
                    </div>
                </div>
                <div class="col-sm-2">
                    <input id="leaderOpinion" name="leaderOpinion" class="form-control" th:field="*{leaderOpinion}" type="text">
                </div>
                <div class="col-sm-2" th:if="*{leaderFlag != '' && leaderFlag != null}">
                    <div class="form-control-static" th:text="*{leaderName}">
                    </div>
                    <div class="form-control-static" th:text="*{#dates.format(leaderTime, 'yyyy-MM-dd HH:mm:ss')}">
                    </div>
                </div>
            </div>
            <div class="form-group" th:if="*{userType == '02'}">
                <label class="col-sm-3 control-label">行政领导意见：</label>
                <div class="col-sm-2">
                    <div class="radio-box">
                        <input type="radio" name="adminFlag" value="1" th:field="*{adminFlag}">
                        <label>同意</label>
                    </div>
                    <div class="radio-box">
                        <input type="radio" name="adminFlag" value="2" th:field="*{adminFlag}">
                        <label>不同意</label>
                    </div>
                </div>
                <div class="col-sm-2">
                    <input id="adminOpinion" name="adminOpinion" class="form-control" th:field="*{adminOpinion}" type="text">
                </div>
                <div class="col-sm-2" th:if="*{adminFlag != '' && adminFlag != null}">
                    <div class="form-control-static" th:text="*{adminName}">
                    </div>
                    <div class="form-control-static" th:text="*{#dates.format(adminTime, 'yyyy-MM-dd HH:mm:ss')}">
                    </div>
                </div>
            </div>
            <div class="form-group" th:if="*{userType == '02'}">
                <label class="col-sm-3 control-label">党委书记意见：</label>
                <div class="col-sm-4">
                    <div class="radio-box">
                        <input type="radio" name="partyFlag" value="1" th:field="*{partyFlag}">
                        <label>同意</label>
                    </div>
                    <div class="radio-box">
                        <input type="radio" name="partyFlag" value="2" th:field="*{partyFlag}">
                        <label>不同意</label>
                    </div>
                </div>
                <div class="col-sm-2">
                    <input id="partyOpinion" name="partyOpinion" class="form-control" th:field="*{partyOpinion}" type="text">
                </div>
                <div class="col-sm-2" th:if="*{partyFlag != '' && partyFlag != null}">
                    <div class="form-control-static" th:text="*{partyName}">
                    </div>
                    <div class="form-control-static" th:text="*{#dates.format(partyTime, 'yyyy-MM-dd HH:mm:ss')}">
                    </div>
                </div>
            </div>
        </form>
    </div>
    <th:block th:include="include :: footer" />
    <script th:inline="javascript">
        var prefix = ctx + "record/leave/verify"
        var verifyType = [[${verifyType}]];

        $(function(){
            $('input[name="chiefFlag"]').attr('disabled', "disabled");
            $("#chiefOpinion").attr("disabled","disabled");
            $('input[name="manageFlag"]').attr('disabled', "disabled");
            $("#manageOpinion").attr("disabled","disabled");
            $('input[name="humanFlag"]').attr('disabled', "disabled");
            $("#humanOpinion").attr("disabled","disabled");
            $('input[name="leaderFlag"]').attr('disabled', "disabled");
            $("#leaderOpinion").attr("disabled","disabled");
            $('input[name="adminFlag"]').attr('disabled', "disabled");
            $("#adminOpinion").attr("disabled","disabled");
            $('input[name="partyFlag"]').attr('disabled', "disabled");
            $("#partyOpinion").attr("disabled","disabled");
            if(verifyType == 'chief') {
                $('input[name="chiefFlag"]').removeAttr('disabled');
                $("#chiefOpinion").removeAttr("disabled");
            } else if(verifyType == 'manage') {
                $('input[name="manageFlag"]').removeAttr('disabled');
                $("#manageOpinion").removeAttr("disabled");
            } else if(verifyType == 'human') {
                $('input[name="humanFlag"]').removeAttr('disabled');
                $("#humanOpinion").removeAttr("disabled");
            } else if(verifyType == 'leader') {
                $('input[name="leaderFlag"]').removeAttr('disabled');
                $("#leaderOpinion").removeAttr("disabled");
            } else if(verifyType == 'admin') {
                $('input[name="adminFlag"]').removeAttr('disabled');
                $("#adminOpinion").removeAttr("disabled");
            } else if(verifyType == 'party') {
                $('input[name="partyFlag"]').removeAttr('disabled');
                $("#partyOpinion").removeAttr("disabled");
            }
        })

        function submitHandler() {
            if ($.validate.form()) {
                var flag = $('input[name="' + verifyType + 'Flag"]:checked').val();
                if(flag == undefined) {
                    $.modal.alertError("请选择审批意见");
                    return;
                }
                $.operate.save(prefix + "/save", $('#form-leave-verify').serialize());
            }
        }
    </script>
</body>
</html>